<template>
  <div>
    <el-row :gutter="20">
      <el-col :xs="24" :sm="24" :md="12" :lg="6">
        <el-card class="update-log">
          <div slot="header" class="clearfix">
            <span>TEMPERATURE</span>
          </div>
          <div class="body">
            <p class="top-title">80%</p>
            <p class="top-desc-line">Warning times 80</p>
          </div>
        </el-card>
      </el-col>
      <el-col :xs="24" :sm="24" :md="12" :lg="6">
        <el-card class="update-log">
          <div slot="header" class="clearfix">
            <span>HUMIDITY</span>
          </div>
          <div class="body">
            <p class="top-title">80%</p>
            <p class="top-desc-line">Warning times 80</p>
          </div>
        </el-card>
      </el-col>
      <el-col :xs="24" :sm="24" :md="12" :lg="6">
        <el-card class="update-log">
          <div slot="header" class="clearfix">
            <span>PRESSURE</span>
          </div>
          <div class="body">
            <p class="top-title">80%</p>
            <p class="top-desc-line">Warning times 80</p>
          </div>
        </el-card>
      </el-col>
      <el-col :xs="24" :sm="24" :md="12" :lg="6">
        <el-card class="update-log">
          <div slot="header" class="clearfix">
            <span>ONLINE RATE</span>
          </div>
          <div class="body">
            <p class="top-title">78%</p>
            <p class="top-desc-line">
              <span>Weekly 12%</span>
              <span>Dayly 24%</span>
            </p>
          </div>
        </el-card>
      </el-col>
    </el-row>

    <el-row :gutter="20">
      <el-col :sm="24" :lg="24">
        <div class="charts-box">
          <div class="charts-box-header">
            Discharge of water
          </div>
          <div class="charts-box-body">
            <div id="chart7" style="width:100%;height: 250px" class="echartMap-line"></div>
          </div>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import * as echarts from "echarts";
require('echarts/theme/macarons') // echarts theme
const animationDuration = 500

export default {
  name: "tabDetail",
  created() {

  },
  mounted() {
    let that = this
    this.$nextTick(function () {
      that.initChart()
    })
  },
  methods: {
    initChart() {
      this.chart = echarts.init(document.getElementById('chart7'));
      this.chart.setOption({
        tooltip: {
          trigger: 'axis',
          axisPointer: { // 坐标轴指示器，坐标轴触发有效
            type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
          }
        },
        grid: {
          top: 10,
          left: '2%',
          right: '2%',
          bottom: '3%',
          containLabel: true
        },
        xAxis: [{
          type: 'category',
          data: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
          axisTick: {
            alignWithLabel: true
          }
        }],
        yAxis: [{
          type: 'value',
          axisTick: {
            show: false
          }
        }],
        series: [{
          name: 'pageA',
          type: 'bar',
          stack: 'vistors',
          barWidth: '60%',
          data: [79, 52, 200, 334, 390, 330, 220, 80, 52, 200, 334, 390],
          animationDuration
        }]
      })
    }
  }
}
</script>

<style scoped>

.top-title {
  font-size: 20px;
  color: #333;
  font-weight: 500;
  margin: 0 !important;
}

.top-desc-line {
  display: flex;
  color: #aaa;
}

.charts-box {
  display: flex;
  flex-direction: column;
  padding: 10px;
  background: #fff;
  border-radius: 5px;
  margin-top: 20px;
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, .1);
}

.charts-box-body {
  width: 100%;
}
</style>
